package com.chiaching.framwork.config;

import lombok.Data;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.elasticsearch.client.ClientConfiguration;
import org.springframework.data.elasticsearch.client.RestClients;
import org.springframework.data.elasticsearch.config.AbstractElasticsearchConfiguration;
import org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate;

import javax.annotation.Resource;

/**
 * @author jiajing.he
 * @date 2021/5/26 下午2:49
 */
//@Configuration
//@ConditionalOnProperty(name = "super.elasticsearch.isEnable",matchIfMissing = false,havingValue = "true")
//@ConfigurationProperties(prefix = "super.elasticsearch")
@Data
public class ElasticSearchConfig /*extends AbstractElasticsearchConfiguration*/ {

    /*private String host;

    @Override
    @Bean
    public RestHighLevelClient elasticsearchClient() {
        final ClientConfiguration clientConfiguration = ClientConfiguration.builder()
                .connectedTo(this.host)
                .build();
        return RestClients.create(clientConfiguration).rest();
    }*/

    @Resource
    private ElasticsearchRestTemplate elasticsearchRestTemplate;

    @Bean
    public void init(){
        //elasticsearchRestTemplate.putMapping()
    }
}
